package com.ncr.travel.appmgr.model;

import com.ncr.travel.appmgr.model.shared.Function;
import com.ncr.travel.appmgr.model.shared.FunctionControls;
import com.ncr.travel.appmgr.model.shared.StationsAuditCriteria;

/**
 * @author ng185038
 * 
 */
public class FunctionJson extends ConfigurationJson implements Function {

	private boolean active;
	private StationsAuditCriteria auditCriteria;
	private FunctionControls functionControls;

	public FunctionJson() {
		super();
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Function#isActive()
	 */
	@Override
	public boolean isActive() {
		return active;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Function#setActive(boolean)
	 */
	@Override
	public void setActive(boolean active) {
		this.active = active;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Function#getAuditCriteria()
	 */
	@Override
	public StationsAuditCriteria getAuditCriteria() {
		return auditCriteria;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Function#setAuditCriteria(com.ncr.travel.appmgr.model.StationsAuditCriteriaJson)
	 */
	@Override
	public void setAuditCriteria(StationsAuditCriteria auditCriteria) {
		this.auditCriteria = auditCriteria;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Function#getFunctionControls()
	 */
	@Override
	public FunctionControls getFunctionControls() {
		return functionControls;
	}

	/* (non-Javadoc)
	 * @see com.ncr.travel.appmgr.model.Function#setFunctionControls(com.ncr.travel.appmgr.model.shared.FunctionControls)
	 */
	@Override
	public void setFunctionControls(FunctionControls functionControls) {
		this.functionControls = functionControls;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + (active ? 1231 : 1237);
		result = prime * result + ((auditCriteria == null) ? 0 : auditCriteria.hashCode());
		result = prime * result + ((functionControls == null) ? 0 : functionControls.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		FunctionJson other = (FunctionJson) obj;
		if (active != other.active)
			return false;
		if (auditCriteria == null) {
			if (other.auditCriteria != null)
				return false;
		} else if (!auditCriteria.equals(other.auditCriteria))
			return false;
		if (functionControls == null) {
			if (other.functionControls != null)
				return false;
		} else if (!functionControls.equals(other.functionControls))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "FunctionJson [active=" + active + ", auditCriteria=" + auditCriteria + ", functionControls=" + functionControls + ", getId()=" + getId() + ", getName()=" + getName() + "]";
	}

}
